﻿using System;
using Microsoft.Goldenlight.Collections;
using Microsoft.Goldenlight.Framework.Lights;

namespace Microsoft.Goldenlight.Framework.Scene
{
    /// <summary>
    /// </summary>
    public class SceneGraph2D : GameObject
    {
        #region Fields & Properties

        private SceneContainer2D _container;

        /// <summary>
        /// 	Scene container which can be queried for objects in the scene.
        /// </summary>
        public SceneContainer2D Container
        {
            get
            {
                return _container;
            }
            set
            {
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }
                _container = value;
                _container.SceneGraph = this;
            }
        }

        private SceneCamera2D _camera;

        /// <summary>
        /// 	The camera used for rendering. The camera determines the view of the world that is rendered, included position and field of view of the camera.
        /// </summary>
        public virtual SceneCamera2D Camera
        {
            get
            {
                return _camera;
            }
            set
            {
                _camera = value;
            }
        }

        #endregion

        #region Constructors

        public SceneGraph2D(bool createSceneContainer)
        {
            if(createSceneContainer)
            {
                _container = new SceneContainer2D(this);
            }
        }

        #endregion

        #region Light Operations

        #region Fields & Properties

        private readonly DoublyLinkedList<Light> _lights = new DoublyLinkedList<Light>();

        #endregion

        #endregion

        #region Scene Object Operations

        #region Add & Remove

        /// <summary>
        /// 	Add an object to the scene graph. The object type must be compatible with the current scene graph or this call will fail.
        /// </summary>
        /// <param name="sceneObject"> Object to add. </param>
        public void AddSceneObject(SceneObject2D sceneObject)
        {
        }

        /// <summary>
        /// 	Remove an object from the scene graph. If the scene object is not in the scene graph then no action is taken.
        /// </summary>
        /// <param name="sceneObject"> Object to remove. </param>
        public void RemoveSceneObject(SceneObject2D sceneObject)
        {
        }

        #endregion

        #endregion

        #region Render Operations

        #region Fields & Properties

        protected RenderState _renderState = new RenderState();

        #endregion

        #endregion
    }
}